class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        sort(points.begin(),points.end());
        int right=points[0][1];
        int n=points.size();
        int count=0;
        for(int i=1;i<n;i++)
        {
            if(points[i][0]<=right)//可以合并，有公共区域
            {
                right=min(right,points[i][1]);
            }
            else//不能合并，更新下一波
            {
                count++;
                right=points[i][1];
            }
        }
        count++;
        return count;

    }
};